﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using JsonPrettyPrinterPlus;

namespace WebFramework.ActionResults
{
    public class JsonResult : IActionResult
    {
        private string _json;

        public JsonResult(string input)
        {
            _json = input;
        }

        public static implicit operator JsonResult(string input)
        {
            return new JsonResult(input);
        }

        public void Render(HttpResponse response)
        {
            response.ContentType = "application/json";
            response.Write(JsonFormatter.PrettyPrint(_json));
        }
    }
}